package org.example.project01.controller;


import org.apache.ibatis.annotations.Param;
import org.example.project01.common.PageData;
import org.example.project01.common.ResponseData;
import org.example.project01.domain.GoodsList;
import org.example.project01.service.IGoodsListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class GoodsListController {
@Autowired
    private IGoodsListService goodsListService;
@PostMapping("/addGoods")
    public ResponseData<GoodsList> addGoods(@RequestBody  GoodsList goodsList)
    {
        return goodsListService.addGoods(goodsList);
    }
@DeleteMapping("/deleteGoods")
    public ResponseData<GoodsList> deleteGoods(@Param("goodsId") String goodsId)
    {
        return goodsListService.deleteGoods(goodsId);
    }
@PutMapping("/modifyGoods")
    public ResponseData<GoodsList> modifyGoods(@RequestBody GoodsList goodsList)
    {
        return goodsListService.modifyGoods(goodsList);
    }
@GetMapping("/getGoods")
    public ResponseData<PageData<GoodsList>> getGoods(@Param("goodsId") String goodsId)
    {
        return goodsListService.getGoods(goodsId);
    }

}
